import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '渠道',
    align:"center",
    dataIndex: 'channel'
   },
   {
    title: '手机号',
    align:"center",
    dataIndex: 'mobile'
   },
   {
    title: '省份',
    align:"center",
    dataIndex: 'province'
   },
   {
    title: '金额(分)',
    align:"center",
    dataIndex: 'fee'
   },
   {
    title: '验证码',
    align:"center",
    dataIndex: 'verifycode'
   },
   {
    title: '请求参数',
    align:"center",
    dataIndex: 'req'
   },
   {
    title: '响应参数',
    align:"center",
    dataIndex: 'resp'
   },
   {
    title: '接口名称',
    align:"center",
    dataIndex: 'step'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createtime'
   },
   {
    title: '修改时间',
    align:"center",
    dataIndex: 'updatetime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "渠道",
      field: 'channel',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "手机号",
      field: 'mobile',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "省份",
      field: 'province',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "接口名称",
      field: 'step',
      component: 'Input',
      //colProps: {span: 6},
 	},
     {
      label: "创建时间",
      field: "createtime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '渠道',
    field: 'channel',
    component: 'Input',
  },
  {
    label: '手机号',
    field: 'mobile',
    component: 'Input',
  },
  {
    label: '省份',
    field: 'province',
    component: 'Input',
  },
  {
    label: '金额(分)',
    field: 'fee',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入金额(分)!'},
          ];
     },
  },
  {
    label: '验证码',
    field: 'verifycode',
    component: 'Input',
  },
  {
    label: '请求参数',
    field: 'req',
    component: 'InputTextArea',
  },
  {
    label: '响应参数',
    field: 'resp',
    component: 'InputTextArea',
  },
  {
    label: '接口名称',
    field: 'step',
    component: 'Input',
  },
  {
    label: '创建时间',
    field: 'createtime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '修改时间',
    field: 'updatetime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  channel: {title: '渠道',order: 0,view: 'text', type: 'string',},
  mobile: {title: '手机号',order: 1,view: 'text', type: 'string',},
  province: {title: '省份',order: 2,view: 'text', type: 'string',},
  fee: {title: '金额(分)',order: 3,view: 'text', type: 'string',},
  verifycode: {title: '验证码',order: 4,view: 'text', type: 'string',},
  req: {title: '请求参数',order: 5,view: 'textarea', type: 'string',},
  resp: {title: '响应参数',order: 6,view: 'textarea', type: 'string',},
  step: {title: '接口名称',order: 7,view: 'text', type: 'string',},
  createtime: {title: '创建时间',order: 8,view: 'datetime', type: 'string',},
  updatetime: {title: '修改时间',order: 9,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}